﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using Adatkezelo.Classes;
namespace NEMProjectWebApp.Pages.Admin {
    public partial class tananyagkezeles : System.Web.UI.Page {
        Tananyag_kezelese anyagkezel;
        Login_Kezeles login = new Login_Kezeles();
        protected void Page_Load(object sender, EventArgs e) {
            string redirect = login.BelepesiJogkorEll(Session, 1);
            if (redirect.Length > 0) Response.Redirect(redirect);
            anyagkezel = new Tananyag_kezelese();
        }

        public void dataBinding() {
            TananyagListBox.DataBind();
        }

        protected void TanAnyagFeltoltButton_Click(object sender, EventArgs e) {
            anyagkezel.TananyagFeltoltes(TargyDropDownList.SelectedValue, FileUpload1);
            dataBinding();
        }

        protected void TorlesBtn_Click(object sender, EventArgs e) {
            anyagkezel.TananyagTorol(TananyagListBox.SelectedValue);
            dataBinding();
        }

        protected void TargyDropDownList_SelectedIndexChanged(object sender, EventArgs e) {
            dataBinding();
        }

        protected void TananyagListBox_SelectedIndexChanged(object sender, EventArgs e) {
            anyagkezel.TananyagLetolt(Response, TananyagListBox.SelectedValue);
        }
    }
}